package com.gong.DesignPattern.VisitorPattern;

/**
 * @author GongChang
 * @version 1.0
 * @date 2021/7/8 0008 9:06
 */
public class Test {

    public static void main(String[] args) {
        Cpu cpu = new Cpu("1+1=1");
        Ram ram = new Ram("记住1+1=1");

        Egg egg = new Egg(cpu,ram);
        egg.run();

        UpdateVisitor updateVisitor = new UpdateVisitor();
        cpu.accept(updateVisitor);
        ram.accept(updateVisitor);

        egg.run();
    }
}
